# coding=utf-8
# !/usr/bin/env python
import sys, os

try:
    if sys.argv[1] == "window":
        # 检查数据库改动
        os.system("python manage.py makemigrations")
        os.system("python manage.py migrate")
        # 运行网站
        os.system("python manage.py runserver")
    if sys.argv[1] == "ubuntu":
        # 检查数据库改动
        os.system("python3 manage.py makemigrations")
        os.system("python3 manage.py migrate")
        # 运行网站
        os.system("python3 manage.py runserver 0.0.0.0:8000")
except IndexError as exc:
    # print(exc)
    print("help:")
    print("参数 \'window\' \t在windwos环境下运行")
    print("参数 \'ubuntu\' \t在ubuntuo 或其他Linux环境下运行")
except BaseException as exc:
    print(exc)